﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
Inherits="System.Web.Mvc.ViewPage<IEnumerable<iBuproModel.Department>>" %>
<%@ Import Namespace="IBupro.Extensions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Departments
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2><%:Html.Translate("departments") %></h2>

	<table>
		<thead>
		<tr>
			<th></th>
		   
			<th>
				<%:Html.Translate("name") %>
			</th>
			 <th>
				 <%:Html.Translate("shortcut") %>
			</th>

			<th>
				 <%:Html.Translate("visibility") %>
			</th>
			<th>
				 <%:Html.Translate("departmentPrincipal")%>
			</th>
			<th>
				 <%:Html.Translate("subjects")%>
			</th>
		</tr>
	</thead>
	
		<tbody>
        <% foreach (var item in Model) { %>
			<tr>
				<td>
					<a href="<%= Url.DepartmentEditUrl(item) %>"><%:Html.Translate("edit") %></a> |
					<a href="<%= Url.DepartmentEditPrincipalsUrl(item) %>"><%:Html.Translate("editDepartmentPrincipal")%></a> |
					<a href="<%= Url.DepartmentDetailsUrl(item) %>"><%:Html.Translate("detail") %></a> |
					<% Html.RenderPartial("DepartmentVisibleControl", item);%>
				</td>
				<td>
					<%: item.Name %>
				</td>
				<td>
					<%: item.Shortcut %>
				</td>
				<td>
					<%: item.Visible %>
				</td>
				<td>
					<% foreach (var principal in item.DepartmentPrincipal)
						{ %>
						<a href="<%= Url.UserDetailsUrl(principal) %>"><%: principal.Username%></a>
					<% } %>
				</td>
				
				<td>
					<a href="<%: Url.DepartmentSubjectsFilterUrl(item) %>"><%:Html.Translate("subjects") %></a>
				</td>
			</tr>
            <% } %>
		</tbody>
	

	</table>

	<p>
		<a href="<%= Url.DepartmentCreateUrl() %>"><%:Html.Translate("createNew")%></a>
	</p>

</asp:Content>

